package cn.jc.myfile.filework.controller;

import cn.jc.myfile.common.entity.result.R;
import cn.jc.myfile.filework.service.IFileWorkService;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/filework")
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class FileWorkController {

    private final IFileWorkService fileWorkService;

    @GetMapping("/fileList")
    public List<String> fileList(@RequestParam(value = "rootPath", required = false) String rootPath) {
        List<String> pathList = fileWorkService.queryFilePathList(rootPath);
        return pathList;
    }

    @PostMapping("/status")
    public List<String> fileListt(@RequestParam(value = "rootPath", required = false) String rootPath) {
        List<String> pathList = fileWorkService.queryFilePathList(rootPath);
        return pathList;
    }
}
